package cn.iocoder.yudao.module.vlog.framework;

import cn.iocoder.yudao.framework.datapermission.core.rule.uni.UniDataPermissionRuleCustomizer;
import cn.iocoder.yudao.module.vlog.comment.dal.dataobject.VLogCommentDO;
import cn.iocoder.yudao.module.vlog.info.dal.dataobject.VLogInfoDO;
import cn.iocoder.yudao.module.vlog.product.dal.dataobject.VLogProductDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类
 */
@Configuration(proxyBeanMethods = false)
public class VlogDataPermissionConfiguration {

    @Bean
    public UniDataPermissionRuleCustomizer vlogDataPermissionRuleCustomizer() {
        return rule -> {
            // shop 基于店铺的数据权限
            rule.addDataColumn(VLogInfoDO.class, "shop_id"); // WHERE shop_id = ?
            rule.addDataColumn(VLogCommentDO.class, "shop_id"); // WHERE shop_id = ?
            rule.addDataColumn(VLogProductDO.class, "shop_id"); // WHERE shop_id = ?
        };
    }

}
